<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Earning extends Model
{
    protected $fillable = [
        'data_id', 'type', 'coins', 'user_id', 'money', 'earning_user_id'
    ];

    public function data()
    {
        return $this->belongsTo('App\Data', 'data_id', 'id');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }

    public function earning()
    {
        return $this->belongsTo('App\User','earning_user_id', 'id');
    }
}
